<!--
  @author heguanghua
  @since 2020/05/07 09:32
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head th:include="common/common::jscss"/>
<body>

<div class="layui-fluid"
     th:with="hasDetail=${#authPermit.checkPermit('/staff/detail.action')},
     hasList=${#authPermit.checkPermit('/staff/list.action')},
     hasAddEdit=${#authPermit.checkPermit('/staff/modify/addEdit.action')},
     hasArchives=${#authPermit.checkPermit('/staff/staffarchives/addEditView.action')},
     hasContract=${#authPermit.checkPermit('/staff/staffcontract/addEditView.action')},
     hasFamily=${#authPermit.checkPermit('/staff/stafffamily/listByStaffId.action')},
     hasLeaveoffice=${#authPermit.checkPermit('/staff/staffleaveoffice/addEditView.action')},
     hasPerformance=${#authPermit.checkPermit('/staff/staffperformance/listByStaffId.action')},
     hasChangelog=${#authPermit.checkPermit('/staff/staffchangelog/list.action')},
     hasStaffRoleList=${#authPermit.checkPermit('/staff/role/list.action')},
     hasMobileAuth=${#authPermit.checkPermit('/staff/mobileAuth.action')},
     hasDpermitOrganizeList=${#authPermit.checkPermit('/staff/dpermit/organize/tree.action')}">

    <blockquote class="layui-crumb">
        <a th:lay-href="|${SYS_MCC}/staff/list.action|">员工管理</a>
        &nbsp;>&nbsp;
        <zmn th:text="${(obj.staffId eq null) ? '新增员工' : obj.staffName}">新增或修改员工</zmn>
    </blockquote>

    <div class="layui-card">
        <div th:replace="staff/_tab::tab"></div>

        <div class="layui-card-body">

            <form method="POST" action="" class="layui-form" lay-filter="zmn-form">

                <input type="hidden" name="staffId" th:value="${obj.staffId}"/>

                <div class="layui-card-header layui-margin-b"><b>基本信息</b></div>

                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="requireMark">*</span>员工类型：</label>
                    <div class="layui-input-block">
                        <input type="radio" name="type" lay-verify="required" th:disabled="${(obj.type != null && obj.type != 6 && obj.type != 8 && obj.type != 3) || (type.key != 6 && type.key != 8 && type.key != 3)}"
                               th:checked="${type.key == obj.type}"
                               th:each="type:${types}"
                               th:value="${type.key}"
                               th:title="${type.value}"/>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="requireMark">*</span>账号：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="staffName" th:value="${obj.staffName}" placeholder="员工的名称"
                               lay-verify="required" autocomplete="off" class="layui-input layui-disabled"
                               maxlength="20" disabled="disabled"/>
                    </div>
                    <div class="layui-form-mid layui-word-aux">账号和工号一致</div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="requireMark">*</span>员工姓名：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="realName" id="realName" th:value="${obj.realName}" placeholder="真实姓名"
                               lay-verify="required" autocomplete="off" class="layui-input" maxlength="10"/>
                    </div>
                    <div class="layui-input-inline">
                        <input type="text" name="pinyinName" id="pinyinName" th:value="${obj.pinyinName}"
                               placeholder="姓名拼音"
                               lay-verify="required" autocomplete="off" class="layui-input" maxlength="30"/>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="requireMark">*</span>性别：</label>
                    <div class="layui-input-inline">
                        <select name="sex" id="sex" lay-verify="required" th:disabled="${obj.staffId != null && obj.type != 3 && obj.type != 6 && obj.type != 8}">
                            <option value="">-选择-</option>
                            <option th:value="${sexType.key}" th:selected="${sexType.key == obj.sex}"
                                    th:text="${sexType.value}" th:each="sexType:${sexTypes}">
                            </option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="requireMark">*</span>手机号：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="mobile" id="mobile" th:value="${hasMobileAuth? obj.mobile : desensitizedMobile}" placeholder="手机号"
                               lay-verify="required|isMobile" autocomplete="off" class="layui-input"
                               maxlength="11"/>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="requireMark">*</span>邮箱：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="mail" id="mail" th:value="${obj.mail}" placeholder="邮箱"
                               lay-verify="required|email" autocomplete="off" class="layui-input"
                               maxlength="50"/>
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="item-inline">
                        <label class="layui-form-label">
                            <span class="requireMark">*</span>所属组织：
                        </label>
                        <div class="layui-input-inline">
                            <div id="plat" name="plat"></div>
                        </div>
                        <div class="layui-input-inline">
                            <div id="orgTwoId" name="orgTwoId"></div>
                        </div>
                        <div class="layui-input-inline">
                            <div id="orgId" name="orgId"></div>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="requireMark">*</span>所属部门：</label>
                    <div class="layui-input-inline">
                        <div id="deptId"></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="requireMark">*</span>工作地点：</label>
                    <div class="layui-input-inline">
                        <div id="workPlaceProvince"></div>
                    </div>
                    <div class="layui-input-inline">
                        <div id="workPlaceCity"></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="requireMark">*</span>工作时间：</label>
                    <div class="layui-input-inline">
                        <input class="layui-input" type="text" id="workTime" name="workTime" placeholder="HH:mm:ss - HH:mm:ss" lay-verify="required" autocomplete="off">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="requireMark">*</span>职务：</label>
                    <div class="layui-input-inline">
                        <select name="postId" id="postId" lay-search="" lay-verify="required" th:disabled="${obj.staffId != null && obj.type != 3 && obj.type != 6 && obj.type != 8}">
                            <option value="">请选择</option>
                            <option th:each="role:${roles}"
                                    th:value="${role.roleId}"
                                    th:text="${role.roleName}"
                                    th:selected="${role.roleId == obj.postId}"></option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="requireMark"></span>职级类别：</label>
                    <div class="layui-input-block">
                        <div class="layui-input-inline">
                            <select name="gradesType" lay-search=""  th:disabled="${obj.staffId != null && obj.type != 3 && obj.type != 6 && obj.type != 8}">
                                <option value="">请选择</option>
                                <option th:each="position:${positions}" th:value="${position.key}"
                                        th:text="${position.value}"
                                        th:selected="${position.key == obj.gradesType}"></option>
                            </select>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="requireMark">*</span>直线经理：</label>
                    <div class="layui-input-block">
                        <div class="layui-input-inline">
                            <div id="leaderId"></div>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="requireMark">*</span>员工状态：</label>
                    <div class="layui-input-block">
                        <div class="layui-input-inline">
                            <select name="staffStatus" lay-search="" lay-verify="required" th:disabled="${obj.staffId != null && obj.type != 3 && obj.type != 6 && obj.type != 8}">
                                <option value="">请选择</option>
                                <option th:each="status:${staffStatusList}" th:value="${status.key}"
                                        th:text="${status.value}"
                                        th:selected="${status.key == obj.staffStatus}"></option>
                            </select>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="requireMark">*</span>入职时间：</label>
                    <div class="layui-input-block">
                        <div class="layui-input-inline">
                            <input type="text" name="entryTime" th:value="${obj.entryTime}" class="layui-input"
                                   id="entryTime" placeholder="yyyy-MM-dd" lay-verify="required" autocomplete="off">
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">转正时间：</label>
                    <div class="layui-input-block">
                        <div class="layui-input-inline">
                            <input type="text" name="becomeFormalTime" th:value="${obj.becomeFormalTime}"
                                   class="layui-input" id="becomeFormalTime"
                                   placeholder="yyyy-MM-dd" autocomplete="off">
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">备注：</label>
                    <div class="layui-input-block">
                        <div class="layui-input-inline" style="width:600px;">
                        <textarea placeholder="50字以内" maxlength="50" th:text="${obj.remark}" id="remark" name="remark"
                                  class="layui-textarea"></textarea>
                        </div>
                    </div>
                </div>

                <zmn th:if="${obj.staffId > 0}">
                    <div class="layui-card-header layui-margin-b"><b>其他信息</b></div>

                    <div class="layui-form-item layui-form-item-sm">
                        <label class="layui-form-label">是否白名单内：</label>
                        <div class="layui-input-block">
                            <div class="layui-form-mid layui-word-aux"
                                 th:text="${T(com.zmn.common.dictionary.GlobalDict).getYesOrNo(obj.whitelist * 1)}">
                                是否白名单内
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-item-sm">
                        <label class="layui-form-label">自定义功能权限：</label>
                        <div class="layui-input-block">
                            <div class="layui-form-mid layui-word-aux"
                                 th:text="${T(com.zmn.common.dictionary.GlobalDict).getYesOrNo(obj.permitSelf * 1)}">
                                自定义功能权限
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-item-sm">
                        <label class="layui-form-label">自定义组织权限：</label>
                        <div class="layui-input-block">
                            <div class="layui-form-mid layui-word-aux"
                                 th:text="${T(com.zmn.common.dictionary.GlobalDict).getYesOrNo(obj.dpermitOrgSelf * 1)}">
                                自定义组织权限
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-item-sm">
                        <label class="layui-form-label">自定义部门权限：</label>
                        <div class="layui-input-block">
                            <div class="layui-form-mid layui-word-aux"
                                 th:text="${T(com.zmn.common.dictionary.GlobalDict).getYesOrNo(obj.dpermitDeptSelf * 1)}">
                                自定义部门权限
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-item-sm">
                        <label class="layui-form-label">自定义区域权限：</label>
                        <div class="layui-input-block">
                            <div class="layui-form-mid layui-word-aux"
                                 th:text="${T(com.zmn.common.dictionary.GlobalDict).getYesOrNo(obj.dpermitAreaSelf * 1)}">
                                自定义区域权限
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-item-sm">
                        <label class="layui-form-label">自定义渠道权限：</label>
                        <div class="layui-input-block">
                            <div class="layui-form-mid layui-word-aux"
                                 th:text="${T(com.zmn.common.dictionary.GlobalDict).getYesOrNo(obj.dpermitChannelSelf * 1)}">
                                自定义渠道权限
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-item-sm">
                        <label class="layui-form-label">自定义报表权限：</label>
                        <div class="layui-input-block">
                            <div class="layui-form-mid layui-word-aux"
                                 th:text="${T(com.zmn.common.dictionary.GlobalDict).getYesOrNo(obj.dpermitCubeSelf * 1)}">
                                自定义报表权限
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-item-sm">
                        <label class="layui-form-label">自定义指标权限：</label>
                        <div class="layui-input-block">
                            <div class="layui-form-mid layui-word-aux"
                                 th:text="${T(com.zmn.common.dictionary.GlobalDict).getYesOrNo(obj.dpermitMeasureSelf * 1)}">
                                自定义报表权限
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-item-sm">
                        <label class="layui-form-label">自定义产品权限：</label>
                        <div class="layui-input-block">
                            <div class="layui-form-mid layui-word-aux"
                                 th:text="${T(com.zmn.common.dictionary.GlobalDict).getYesOrNo(obj.dpermitProductSelf * 1)}">
                                自定义产品权限
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-item-sm">
                        <label class="layui-form-label">最近登录时间：</label>
                        <div class="layui-input-block">
                            <div class="layui-form-mid layui-word-aux"
                                 th:text="${#dates.format(obj.updateTime, 'yyyy-MM-dd HH:mm:ss')}">最近登录时间
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-item-sm">
                        <label class="layui-form-label">修改人/时间：</label>
                        <div class="layui-input-block">
                            <div class="layui-form-mid layui-word-aux"
                                 th:text="${obj.updater} + '&nbsp;/&nbsp;' + ${#dates.format(obj.updateTime, 'yyyy-MM-dd HH:mm:ss')}">
                                修改人/时间
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-item-sm">
                        <label class="layui-form-label">创建人/时间：</label>
                        <div class="layui-input-block">
                            <div class="layui-form-mid layui-word-aux"
                                 th:text="${obj.creater} + '&nbsp;/&nbsp;' + ${#dates.format(obj.createTime, 'yyyy-MM-dd HH:mm:ss')}">
                                创建人/时间
                            </div>
                        </div>
                    </div>
                </zmn>

                <div class="layui-form-item layui-layout-admin" th:if="${hasAddEdit}">
                    <div class="layui-input-block">
                        <div class="layui-footer" style="left: 0;">
                            <button class="layui-btn" lay-submit="" lay-filter="zmn-form-submit">保存</button>
                            <button id="cancel" type="button" class="layui-btn layui-btn-primary">取消</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
</html>
<style type="text/css">
    xm-select .xm-label .scroll .label-content {
        color: black !important;
    }
    .requireMark{
       color: red;
    }
</style>

<script type="text/javascript" th:inline="javascript">
    const json = {
        plat: [[${obj.plat}]],
        orgTwoId: [[${obj.orgTwoId}]],
        orgId: [[${obj.orgId}]],
        deptOneId: [[${obj.deptOneId}]],
        deptTwoId: [[${obj.deptTwoId}]],
        deptThrId: [[${obj.deptThrId}]],
        deptId: [[${obj.deptId}]],
        staff: [[${obj}]],
        hasMobileAuth : [[${#authPermit.checkPermit('/staff/mobileAuth.action')}]],
        roles: [[${roles}]],
    };
    layui.extend({
        staff_detail: "staff/zmn.staff.detail",
    }).use(['index', 'staff_detail']);
</script>
